package one.stand.controller.index;

import cn.hutool.core.collection.CollUtil;
import com.jmp.api.dto.*;
import com.jmp.api.util.LabelUtil;
import com.jmp.autocofiguration.web.interceptor.SecurityAuthCheck;
import com.jmp.base.DynamicApi;
import com.jmp.base.TemplateApi;
import com.jmp.base.UserApi;
import com.jmp.base.dto.LiveListRequest;
import com.jmp.base.dto.*;
import com.jmp.feign.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import one.stand.advice.ResultEnum;
import one.stand.dto.*;
import one.stand.enums.LoginEnum;
import one.stand.enums.SeeRecordEnums;
import one.stand.model.*;
import one.stand.service.*;
import one.stand.service.sys.SysDictValueService;
import one.stand.service.user.UserAdminService;
import one.stand.util.*;
import org.apache.commons.lang3.BooleanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Objects;

@Api(description = "直播:观看直播")
@RestController
@RequestMapping("live")
public class LiveController2 {
    public static SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd HH:mm");

    @Autowired
    private LiveFeign liveFeign;
    @Autowired
    private RecordFeign recordFeign;
    @Autowired
    private TemplateFeign templateFeign;
    @Autowired
    private AccountFeign accountFeign;
    @Autowired
    private UserFeign userFeign;
    @Autowired
    private DynamicFeign dynamicFeign;

    @Autowired
    private GoodsPhotoService goodsPhotoService;
    @Autowired
    private GoodsBaseService goodsBaseService;
    @Autowired
    private CompanyBaseService companyBaseService;
    @Autowired
    private BusinessCardBaseService businessCardBaseService;
    @Autowired
    private RecordPublicService recordPublicService;
    @Autowired
    private SysDictValueService sysDictValueService;
    @Autowired
    private UserAdminService userAdminService;

    @ApiOperation(value = "1直播大厅")
    @RequestMapping("list")
    public ResultModel<LiveListResponse> list(@RequestAttribute com.jmp.api.dto.LiveListRequest request) {
        final RequestContext requestContext = RequestContextHolder.getRequestContext();

        if (requestContext.isLogin() && request.getPageNum() == 1) {
            userFeign.viewSave(UserViewSaveDto.builder().userId(requestContext.getUser().getUserId()).type(UserApi.VIEW_TYPE_LIVE).build());
        }

        LiveListRequest liveListRequest = LiveListRequest.builder()
                .keyword(request.getKeyword())
                .build();
        liveListRequest.setPageNum(request.getPageNum());
        liveListRequest.setPageSize(request.getPageSize());
        ResultModel<LiveListVo> liveListVoResultModel = liveFeign.list(liveListRequest);
        AssertUtil.isTrue(liveListVoResultModel);
        PageResponse2<LiveListResponse.Live> livePage = ConvertUtils.page2(liveListVoResultModel.getData().getLivePage(), live -> {
            BusinessCard businessCard = businessCardBaseService.getCustomer(live.getCardId());
            Company2Dto company = companyBaseService.get2(businessCard.getCompanyId());

            LiveListResponse.Video video = null;
            boolean isVideo = live.getStatus() == 2;
            if (isVideo) {
                video = LiveListResponse.Video.builder()
                        .roomId(live.getRoomId())
                        .name(live.getTitle())
                        .photo(live.getPhoto())
                        .videoUrl(live.getReplayUrl())
                        .userCurrentRoomId(live.getUserCurrentRoomId())

                        .cardId(businessCard.getCardId())
                        .cardImg(businessCard.getLogo())
                        .cardName(businessCard.getName())
                        .userId(businessCard.getUserId())
                        .userCollectFlag(BooleanUtils.toInteger(requestContext.isLogin() && recordPublicService.isCollection(requestContext.getUser().getUserId(), RecordPublicService.ITEMTYPE_USER, businessCard.getUserId())))

                        .viewNum(recordPublicService.getPopularity(SeeRecordEnums.LIVE.getCode(), live.getRoomId()))
                        .collectNum(recordPublicService.getCollectionCount(RecordPublicService.ITEMTYPE_LIVE_ROOM, live.getRoomId()))
                        .collectFlag(BooleanUtils.toInteger(requestContext.isLogin() && recordPublicService.isCollection(requestContext.getUser().getUserId(), RecordPublicService.ITEMTYPE_LIVE_ROOM, live.getRoomId())))
                        .commentNum(recordPublicService.countCommentByType(DynamicApi.COMMENT_TYPE_VIDEO, live.getRoomId()))
                        .build();
            }

            return LiveListResponse.Live.builder()
                    .roomId(live.getRoomId())
                    .videoType(BooleanUtils.toInteger(isVideo))
                    .photo(OneStringUtils.photoResize(live.getPhoto()))
                    .title(live.getTitle())
                    .status(LabelUtil.getLiveStatus(live.getStatus()))

                    .viewNum(live.getViewNum() + "人观看")//直播中才显示观看人数
                    .collectNum(recordPublicService.getCollectionCount(RecordPublicService.ITEMTYPE_LIVE_ROOM, live.getRoomId()))

                    .userImg(company.getCompanyLogo())
                    .userName(company.getCompanyName())

                    .video(video)
                    .build();
        });

        int status = -1;
        int videoStatus = 0;
        if (requestContext.isCard()) {
            status = 0;
            boolean hasLive = companyBaseService.isByLabel(requestContext.getUser().getCompanyId(), CompanyBaseService.LABEL_LIVE);
            videoStatus = BooleanUtils.toInteger(companyBaseService.isByLabel(requestContext.getUser().getCompanyId(), CompanyBaseService.LABEL_VIDEO));
            if (hasLive) {
                ResultModel<LiveInfoResponse> infoResponseResultModel = liveFeign.info(LiveInfoRequest.builder()
                        .cardId(requestContext.getUser().getCardId())
                        .build());
                AssertUtil.isTrue(infoResponseResultModel);
                LiveInfoResponse infoResponse = infoResponseResultModel.getData();
                status = !infoResponse.isOn() ? 1 : 2;
            }
        }

        LiveListResponse response = LiveListResponse.builder()
                .livePage(livePage)
                .status(status)
                .videoStatus(videoStatus)
                .build();
        return ResultModel.success(response);
    }

    @ApiOperation(value = "2直播间、短视频")
    @PostMapping("view")
    @SecurityAuthCheck
    public ResultModel<LiveViewApiResponse> view(@RequestAttribute LiveViewApiRequest request) {
        RequestContext.User optUser = RequestContextHolder.getRequestContext().getUser();

        ResultModel<LiveInfoResponse> infoResponseResultModel = liveFeign.info(LiveInfoRequest.builder()
                .roomId(request.getRoomId())
                .build());
        AssertUtil.isTrue(infoResponseResultModel);
        LiveInfoResponse infoResponse = infoResponseResultModel.getData();
        AssertUtil.isTrue(infoResponse.isHasRoom(), ResultEnum.PARAM_CHECK, "直播已取消");

        BusinessCard businessCard = businessCardBaseService.getCustomer(infoResponse.getCardId());
        Company2Dto company = companyBaseService.get2(businessCard.getCompanyId());
        final boolean hasZkgx = companyBaseService.hasZkgx(businessCard.getCompanyId());
        final boolean userCollect = recordPublicService.isCollection(optUser.getUserId(), RecordPublicService.ITEMTYPE_USER, businessCard.getUserId());

        LiveViewApiResponse.LiveViewApiResponseBuilder response = LiveViewApiResponse.builder()
                .companyId(company.getCompanyId())
                .companyName(company.getCompanyName())
                .companyLogo(company.getCompanyLogo())
                .companyLevel(company.countCompanyLevelView())
                .hasZkgx(BooleanUtils.toInteger(hasZkgx))

                .userId(businessCard.getUserId())
                .cardId(businessCard.getCardId())
                .cardName(businessCard.getName())
                .cardImg(businessCard.getLogo())
                .userCollectFlag(BooleanUtils.toInteger(userCollect))
                .followUserFlag(BooleanUtils.toInteger(userCollect))
                .viewNum(recordPublicService.getPopularity(SeeRecordEnums.LIVE.getCode(), request.getRoomId()))
                .collectNum(recordPublicService.getCollectionCount(RecordPublicService.ITEMTYPE_LIVE_ROOM, request.getRoomId()))
                .collectFlag(BooleanUtils.toInteger(recordPublicService.isCollection(optUser.getUserId(), RecordPublicService.ITEMTYPE_LIVE_ROOM, request.getRoomId())));

        if (infoResponse.isPre()) {//预告
            boolean preFollow = recordPublicService.isCollection(optUser.getUserId(), RecordPublicService.ITEMTYPE_LIVE_ROOM_PRE, request.getRoomId());
            int goodsNum = 0;
            List<String> goodsPhotos = null;
            ResultModel<LiveGoodsListResponse> goodsListResponseResultModel = liveFeign.goodsList(LiveGoodsListRequest.builder()
                    .cardId(optUser.getCardId())
                    .build());
            AssertUtil.isTrue(goodsListResponseResultModel);
            if (OneListUtil.isNotEmpty(goodsListResponseResultModel.getData().getGoodsIds())) {
                goodsNum = goodsListResponseResultModel.getData().getGoodsIds().size();
                List<LiveGoodsListResponse.Goods> goodsIds = CollUtil.sub(goodsListResponseResultModel.getData().getGoodsIds(), 0, 3);
                goodsPhotos = ConvertUtils.list(goodsIds, goods -> OneStringUtils.photoResize(goodsPhotoService.getPath(goods.getGoodsId())));
            }
            response.status(2)
                    .selfFlag(BooleanUtils.toInteger(infoResponse.getCardId().equals(optUser.getCardId())))
                    .roomId(request.getRoomId())
                    .name(infoResponse.getName())
                    .photo(infoResponse.getPhoto())
                    .preTime(DateUtil.format(formatter, infoResponse.getPreTime()))
                    .remainingTime(infoResponse.countRemainingTime())
                    .preFollow(BooleanUtils.toInteger(preFollow))
                    .goodsNum(goodsNum)
                    .goodsPhotos(goodsPhotos);
        } else if (infoResponse.isOn()) {
            response.viewerNum(infoResponse.getViewerNum())
                    .viewerPhotos(infoResponse.getViewerPhotos())
                    .status(0)
                    .roomId(request.getRoomId())
                    .selfFlag(BooleanUtils.toInteger(infoResponse.getCardId().equals(optUser.getCardId())))
                    .pullUrl(infoResponse.getPullUrl())
                    .groupId(infoResponse.getGroupId());
        } else if (infoResponse.isReview()) {
            response.viewerNum(infoResponse.getViewerNum())
                    .viewerPhotos(infoResponse.getViewerPhotos())
                    .status(infoResponse.getVideoType() == 0 ? 1 : 3)
                    .roomId(request.getRoomId())
                    .selfFlag(0)
                    .videoUrl(infoResponse.getVideoUrl())
                    .commentNum(recordPublicService.countCommentByType(DynamicApi.COMMENT_TYPE_VIDEO, infoResponse.getRoomId()));
        } else {
            AssertUtil.fail(ResultEnum.PARAM_CHECK, "直播已取消");
        }

        boolean isCollection = recordPublicService.isCollection(optUser.getUserId(), RecordPublicService.ITEMTYPE_COMPANY, businessCard.getCompanyId());
        response.followFlag(BooleanUtils.toInteger(isCollection));
        boolean isThumbs = recordPublicService.isCollection(optUser.getUserId(), RecordPublicService.ITEMTYPE_LIVE_ROOM, request.getRoomId());
        response.thumbsFlag(BooleanUtils.toInteger(isThumbs));

        if (!RequestContextHolder.getRequestContext().isSelf(businessCard.getUserId())) {//不是同一用户
            recordPublicService.addPopularity(SeeRecordEnums.LIVE, request.getRoomId());
        }

        return ResultModel.success(response.build());
    }

    @ApiOperation(value = "2视频播放统计")
    @PostMapping("view/count")
    @SecurityAuthCheck
    public ResultModel viewCount(@RequestAttribute LiveViewApiRequest request) {
        ResultModel<LiveInfoResponse> infoResponseResultModel = liveFeign.info(LiveInfoRequest.builder()
                .roomId(request.getRoomId())
                .build());
        AssertUtil.isTrue(infoResponseResultModel);
        LiveInfoResponse infoResponse = infoResponseResultModel.getData();
        AssertUtil.isTrue(infoResponse.isHasRoom(), ResultEnum.PARAM_CHECK, "直播已取消");
        BusinessCard businessCard = businessCardBaseService.getCustomer(infoResponse.getCardId());
        if (!RequestContextHolder.getRequestContext().isSelf(businessCard.getUserId())) {//不是同一用户
            recordPublicService.addPopularity(SeeRecordEnums.LIVE, request.getRoomId());
        }
        return ResultModel.success();
    }

    @ApiOperation(value = "3直播间:商品列表")
    @GetMapping("goods")
    @SecurityAuthCheck
    public ResultModel<LiveGoodsApiResponse> goods(@RequestAttribute LiveGoodsApiRequest request) {
        LiveGoodsListRequest goodsListRequest;
        if (Objects.nonNull(request.getRoomId())) {
            goodsListRequest = LiveGoodsListRequest.builder()
                    .roomId(request.getRoomId())
                    .status(1)
                    .build();
        } else {//本人直播
            RequestContext.User optUser = RequestContextHolder.getRequestContext().getUser();
            goodsListRequest = LiveGoodsListRequest.builder()
                    .cardId(optUser.getCardId())
                    .status(request.getStatus())
                    .build();
        }
        ResultModel<LiveGoodsListResponse> infoResponseResultModel = liveFeign.goodsList(goodsListRequest);
        AssertUtil.isTrue(infoResponseResultModel);
        List<LiveGoodsListResponse.Goods> selectGoodsIds = infoResponseResultModel.getData().getGoodsIds();
        List<LiveGoodsApiResponse.Goods> goodsPageResponse2 = ConvertUtils.list(selectGoodsIds, goodsId -> {
            Goods goods = goodsBaseService.get(goodsId.getGoodsId());

            return LiveGoodsApiResponse.Goods.builder()
                    .roomGoodsId(goodsId.getRoomGoodsId())
                    .goodsId(goodsId.getGoodsId())
                    .name(goods.getGoodsName())
                    .photo(goodsPhotoService.getPath(goodsId.getGoodsId()) + "?x-oss-process=image/resize,w_100")
                    .price(goods.getPrice())
                    .status(goodsId.getStatus())
                    .build();
        });

        LiveGoodsApiResponse response = LiveGoodsApiResponse.builder()
                .goodsList(goodsPageResponse2)
                .build();
        return ResultModel.success(response);
    }

    @ApiOperation(value = "3直播间:关注|已废弃,使用【首页-个人主页】")
    @PostMapping("follow")
    @SecurityAuthCheck
    @Deprecated
    public ResultModel follow(@RequestAttribute LiveFollowRequest request) {
        final RequestContext.User optUser = RequestContextHolder.getRequestContext().getUser();

        ResultModel<RecordCollectionVo> resultModel = recordFeign.collection(RecordCollectionDto.builder()
                .userId(optUser.getUserId())
                .itemType(RecordPublicService.ITEMTYPE_COMPANY)
                .itemId(request.getCompanyId())
                .build());
        AssertUtil.isTrue(resultModel);

        return ResultModel.success();
    }

    @ApiOperation(value = "3直播、短视频:点赞")
    @PostMapping("thumbs")
    @SecurityAuthCheck
    public ResultModel thumbs(@RequestAttribute LiveThumbsRequest request) {
        final RequestContext.User optUser = RequestContextHolder.getRequestContext().getUser();

        ResultModel<RecordCollectionVo> resultModel = recordFeign.collection(RecordCollectionDto.builder()
                .userId(optUser.getUserId())
                .itemType(RecordPublicService.ITEMTYPE_LIVE_ROOM)
                .itemId(request.getRoomId())
                .build());
        AssertUtil.isTrue(resultModel);

        return ResultModel.success();
    }

    @ApiOperation(value = "3直播、短视频:分享")
    @PostMapping("/share")
    @SecurityAuthCheck
    public ResultModel<LiveShareResponse> share(@RequestAttribute LiveShareRequest request) {

//        RequestContext.User optUser = RequestContextHolder.getRequestContext().getUser();

        ResultModel<LiveInfoResponse> infoResponseResultModel = liveFeign.info(LiveInfoRequest.builder()
                .roomId(request.getRoomId())
                .build());
        AssertUtil.isTrue(infoResponseResultModel);
        LiveInfoResponse infoResponse = infoResponseResultModel.getData();
        AssertUtil.isTrue(infoResponse.isHasRoom(), ResultEnum.PARAM_CHECK, "直播已取消");

        TemplateGet2Request getRequest = TemplateGet2Request.builder()
                .templateType(TemplateApi.Type.ID_ROOM)
                .cardId(infoResponse.getCardId())
                .roomId(request.getRoomId())
                .build();
        ResultModel<TemplateGetResponse> getResponseResultModel = templateFeign.get2(getRequest);
        AssertUtil.isTrue(getResponseResultModel);
        String cardUrl = getResponseResultModel.getData().getImageUrl();

        BusinessCard card = businessCardBaseService.getCustomer(infoResponse.getCardId());
        AccountCompanyIdRequest accountCompanyIdRequest = AccountCompanyIdRequest.builder()
                .companyId(card.getCompanyId())
                .loginEnum(LoginEnum.USER)
                .build();
        ResultModel<AccountResponse> accountResponseResultModel = accountFeign.getCompanyIdDefaultIfNull(accountCompanyIdRequest);
        String wechatId = accountResponseResultModel.isSuccess() ? accountResponseResultModel.getData().getWechatId() : null;

        LiveShareResponse response = LiveShareResponse.builder()
                .cardUrl(cardUrl)
                .wechatId(wechatId)
                .title(infoResponse.getName())
                .photo(infoResponse.getPhoto())
                .path(recordPublicService.getLiveRoomWxUrl(request.getRoomId()))
                .build();
        return ResultModel.success(response);
    }

    @ApiOperation(value = "3直播间:预约关注")
    @PostMapping("pre/follow")
    @SecurityAuthCheck
    public ResultModel<LivePreFollowResponse> preFollow(@RequestAttribute LivePreFollowRequest request) {
        final RequestContext.User optUser = RequestContextHolder.getRequestContext().getUser();

        ResultModel<RecordCollectionVo> resultModel = recordFeign.collection(RecordCollectionDto.builder()
                .userId(optUser.getUserId())
                .itemType(RecordPublicService.ITEMTYPE_LIVE_ROOM_PRE)
                .itemId(request.getRoomId())
                .build());
        AssertUtil.isTrue(resultModel);

        boolean follow = recordPublicService.isCollection(optUser.getUserId(), RecordPublicService.ITEMTYPE_LIVE_ROOM_PRE, request.getRoomId());
        LivePreFollowResponse response = LivePreFollowResponse.builder()
                .preFollow(BooleanUtils.toInteger(follow))
                .build();
        return ResultModel.success(response);
    }

    @ApiOperation(value = "4短视频：评论列表")
    @GetMapping("comment/list")
    @SecurityAuthCheck
    public ResultModel<LiveCommentListResponse> commentList(@RequestAttribute LiveCommentListRequest request) {

        DynamicCommentListDto commentListDto = DynamicCommentListDto.builder()
                .commentType(DynamicApi.COMMENT_TYPE_VIDEO)
                .dynamicId(request.getRoomId())
                .parentId(request.getCommentParentId())
                .build();
        commentListDto.setPageInit(request.getPageNum(), request.getPageSize());
        ResultModel<DynamicCommentListVo> resultModel = dynamicFeign.commentList(commentListDto);
        AssertUtil.isTrue(resultModel);

        PageResponse2<LiveCommentListResponse.Comment> commentPage = ConvertUtils.page2(resultModel.getData().getCommentPage(), comment -> {
            UserDto user = userAdminService.get(comment.getUserId());
            UserDto userReply = userAdminService.get(comment.getCoverUserId());
            return LiveCommentListResponse.Comment.builder()
                    .commentId(comment.getCommentId())
                    .userId(comment.getUserId())
                    .userImg(Objects.nonNull(user) ? OneStringUtils.photoResize(user.getUserImg()) : null)
                    .userName(user.getName())
                    .replyUserName(userReply.getName())
                    .content(comment.getContent())
                    .createTime(comment.getCreateTime())
                    .thumbsNum(comment.getThumbsNum())
                    .replyNum(comment.getCoverNum())
                    .build();
        });

        LiveCommentListResponse response = LiveCommentListResponse.builder()
                .comentPage(commentPage)
                .build();
        return ResultModel.success(response);
    }

    @ApiOperation(value = "4短视频：评论保存")
    @PostMapping("comment/save")
    @SecurityAuthCheck
    public ResultModel<LiveCommentThumbsResponse> commentSave(@RequestAttribute LiveCommentSaveRequest request) {

        AssertUtil.nonNull(request.getRoomId(), ResultEnum.PARAM_CHECK);
        AssertUtil.nonNull(request.getContent(), ResultEnum.PARAM_CHECK, "评论/回复内容不能为空");

        boolean isOn = sysDictValueService.isOn(SysDictValueService.Type.CONFIG, SysDictValueService.TypeName.COMMENT_SWITCH_APP);
        if (isOn) {
            final RequestContext.User optUser = RequestContextHolder.getRequestContext().getUser();

            ResultModel<LiveInfoResponse> infoResponseResultModel = liveFeign.info(LiveInfoRequest.builder()
                    .roomId(request.getRoomId())
                    .build());
            AssertUtil.isTrue(infoResponseResultModel);
            DynamicCommentSaveDto saveDto = DynamicCommentSaveDto.builder()
                    .commentType(DynamicApi.COMMENT_TYPE_VIDEO)
                    .dynamicId(request.getRoomId())
                    .parentId(request.getCommentParentId())
                    .userId(optUser.getUserId())
                    .text(request.getContent())
                    .cardId(infoResponseResultModel.getData().getCardId())
                    .build();
            ResultModel<DynamicCommentSaveVo> resultModel = dynamicFeign.commentSave(saveDto);
            AssertUtil.isTrue(resultModel);

            UserDto user = userAdminService.get(optUser.getUserId());
            UserDto coverUser = userAdminService.get(resultModel.getData().getCoverUserId());
            LiveCommentThumbsResponse response = LiveCommentThumbsResponse.builder()
                    .commentId(resultModel.getData().getCommentId())
                    .userId(user.getUserId())
                    .userName(user.getName())
                    .userImg(OneStringUtils.photoResize(user.getUserImg()))
                    .userChatId(String.valueOf(optUser.getUserId()))
                    .replyUserName(coverUser.getName())
                    .content(request.getContent())
                    .createTime(new Date().getTime())
                    .thumbsNum(0)
                    .build();
            return ResultModel.success(response);
        } else {
            return ResultModel.fail("已提交，审核通过后显示");
        }
    }

    @ApiOperation(value = "4短视频:评论点赞/取消")
    @PostMapping("comment/thumbs")
    @SecurityAuthCheck
    public ResultModel commentThumbs(@RequestAttribute LiveCommentThumbsRequest request) {
        final RequestContext.User optUser = RequestContextHolder.getRequestContext().getUser();

        ResultModel<RecordCollectionVo> resultModel = recordFeign.collection(RecordCollectionDto.builder()
                .userId(optUser.getUserId())
                .itemType(RecordPublicService.ITEMTYPE_COMMENT)
                .itemId(request.getCommentId())
                .build());
        AssertUtil.isTrue(resultModel);

        dynamicFeign.commentThumbs(DynamicCommentThumbsDto.builder().commentId(request.getCommentId()).thumbsFlag(resultModel.getData().getFlag()).build());

        return ResultModel.success();
    }

    @Data
    public static class LiveCommentSaveRequest {
        @ApiModelProperty("动态ID")
        private Integer roomId;
        @ApiModelProperty("回复的父评论ID,如不是回复,则不传")
        private Integer commentParentId;
        @ApiModelProperty("评论/回复的内容")
        private String content;
    }

    @Data
    public static class LiveCommentThumbsRequest {
        private Integer commentId;
    }

    @Data
    @Builder
    public static class LiveCommentThumbsResponse {
        @ApiModelProperty("评论ID")
        private Integer commentId;
        @ApiModelProperty("评论人")
        private Integer userId;
        @ApiModelProperty("评论人头像")
        private String userImg;
        @ApiModelProperty("评论人名")
        private String userName;
        private String userChatId;
        @ApiModelProperty("回复人名(可能为无)")
        private String replyUserName;
        @ApiModelProperty("评论内容")
        private String content;
        @ApiModelProperty("评论时间")
        private long createTime;
        @ApiModelProperty("点赞数")
        private Integer thumbsNum;
    }

    @Data
    @EqualsAndHashCode(callSuper = true)
    public static class LiveCommentListRequest extends PageRequest {
        private Integer roomId;
        @ApiModelProperty("父评论ID")
        private Integer commentParentId;
    }

    @Data
    @Builder
    public static class LiveCommentListResponse {
        @ApiModelProperty(value = "评论列表", dataType = "LiveCommentListResponse.Comment")
        private PageResponse2<Comment> comentPage;

        @ApiModel("LiveCommentListResponse.Comment")
        @Data
        @Builder
        public static class Comment {
            @ApiModelProperty("评论ID")
            private Integer commentId;
            @ApiModelProperty("评论人")
            private Integer userId;
            @ApiModelProperty("评论人头像")
            private String userImg;
            @ApiModelProperty("评论人名")
            private String userName;
            private String userChatId;
            @ApiModelProperty("回复人名(可能为无)")
            private String replyUserName;
            @ApiModelProperty("评论内容")
            private String content;
            @ApiModelProperty("评论时间")
            private long createTime;
            @ApiModelProperty("点赞数")
            private Integer thumbsNum;
            @ApiModelProperty("回复数")
            private Integer replyNum;
        }
    }
}
